MY HITS
v1.0
Unique Hit Counter
programmed by Cory S.N. LaViska (Feb. 2003)
Questions, comments?
Email: aksival@laviska.com
or visit: http://laviska.com
WHAT IT DOES
My hits is a PHP hit counter that
logs one occurrence of each visitor's IP address. It then displays an
accurate count of the total number of unique visitors to your
website.
HOW IT WORKS
The script is placed on your page
wherever you would like the hit count to show (usually on a home page).
Every time that page is accessed, the script checks a log file for the
user's IP address. If it finds a match, the count is not advanced. If it
does not find a match, the count is incremented by one and the new IP is
appended to the log file. The count is displayed on screen.
CAN I CHANGE FONT COLOR, SIZE, ETC.?
Yes. The count will be printed
in the most recently defined text settings for that page.
FILES
You will need My_Hits.php
and My_hits.txt (should be blank).
CHANGING
THE LOG FILE NAME
You can change My_Hits.txt
to another file name. If you do this, simply change the value of
$file in My_Hits.php to match the new file name.
NOTE:
You cannot refer to a file
remotely to write to it. In other words, do not make
$file equal to http://domain.com/dir/logfile.txt
(Simply omit the http://domain.com part). Although the script will appear to work correctly, new IP addresses will
not be logged.
INSTALLING
1. Copy the script from
My_Hits.php and paste it directly into your HTML code where you
want the count to show. Save the file.
2. Upload the saved file and My_Hits.txt to the same directory
(folder).
3. CHMOD My_Hits.txt to 777.
NOTE: You must upload the blank
My_Hits.txt file for the script to work correctly. If
My_Hits.txt is not present when the script is executed it will display
an error message in lieu of the count! The file will not be automatically
created!
(Bottom portion
intentionally left blank) |